sequenceDiagram
  src-cli   ->>+ Frontend: handleEnqueue?repository,commit,root
  Frontend  ->>+ DB store: InsertUpload(repository, commit, root)
  DB store -->>- Frontend: uploadID
  Frontend -->>- src-cli: 201 Accepted: {"id": uploadID}

  loop
    src-cli      ->>+ Frontend: handleEnqueue?uploadID,index
    Frontend     ->>  Upload store: Upload(uploadID, index)
    Frontend     ->>  DB store: AddUploadPart(uploadID, index)
    Frontend    -->>- src-cli: 204 No Content
  end

  src-cli        ->>+ Frontend: handleEnqueue?uploadID,done
  Frontend       ->>  Upload store: Compose(uploadID)
  Frontend       ->>  DB store: MarkQueued(uploadID)
  Frontend      -->>- src-cli: 204 No Content

  Worker         ->>+ Worker store: Dequeue
  Worker store      -->>- Worker: upload
  Worker         ->>+ Upload store: Get(upload.id)
  Upload store  -->>- Worker: raw LSIF data

  Worker        ->>+ Conversion: Correlate(raw LSIF data, upload.root)
  Conversion   -->>- Worker: grouped bundle data

  Worker         ->>+ LSIF store: BeginTx
  Worker         ->>  LSIF store: WriteMeta(data.meta)
  Worker         ->>  LSIF store: WriteDocuments(data.documents)
  Worker         ->>  LSIF store: WriteResultChunks(data.resultChunks)
  Worker         ->>  LSIF store: WriteDefinitions(data.definitions)
  Worker         ->>  LSIF store: WriteReferences(data.references)
  Worker        -->>  LSIF store: Commit
  LSIF store    -->>- Worker: { }

  Worker         ->>+ DB store: BeginTx
  Worker         ->>  DB store: UpdatePackages(data.packages)
  Worker         ->>  DB store: UpdatePackageReferences(data.references)
  Worker         ->>  DB store: DeleteOverlappingDumps(upload.repository, upload.commit, upload.root)
  Worker         ->>  DB store: MarkRepositoryAsDirty(upload.repository)
  Worker        -->>  DB store: Commit
  DB store      -->>- Worker: { }

  Worker         ->>  Upload store: Delete(upload.id)
